package com.zoltu.GoogleAuthenticator;

import android.accounts.Account;
import android.accounts.AccountManager;
import android.content.Intent;
import android.os.Bundle;
import android.view.View.OnClickListener;

public class UpdateCredentialsActivity extends AddAccountActivity
{
	/* TODO: The UI for this should be different from the UI for AddAccountActivity, though for now both work. */

//	@Override public void AuthenticationSuccss(String pAuthToken)
//	{
//		Intent lIntent = getIntent();
//		Bundle lIntentBundle = getIntent().getExtras();
//		
//		/* Get access to the AccountManager so we can add the account to the accounts store. */
//		AccountManager lAccountManager = AccountManager.get(this);
//		
//		/* Get the account we are updating. */
//		Account lAccount = (Account) lIntentBundle.get(Authenticator.KEY_ACCOUNT);
//		
//		/** The result bundle that will be sent as a response to the original Authenticator request. **/
//		Bundle lResultBundle = new Bundle();
//		
//		/* If the account wasn't found for some reason fail out. */
//		if (lAccount == null)
//		{
//			/* Build the failure bundle to send as a response to the original Authenticator request. */
//			lResultBundle.putInt(AccountManager.KEY_ERROR_CODE, Authenticator.ERROR_CODE_ACCOUNT_NOT_FOUND);
//			lResultBundle.putString(AccountManager.KEY_ERROR_MESSAGE, getResources().getString(R.string.error_account_not_found));
//		}
//		
//		else
//		{
//			/* Set the updated password. */
//			lAccountManager.setPassword(lAccount, mPasswordEditText.getText().toString());
//			
//			/* Build the bundle to send as a response to the original Authenticator request. */
//			lResultBundle.putString(AccountManager.KEY_ACCOUNT_NAME, lAccount.name);
//			lResultBundle.putString(AccountManager.KEY_ACCOUNT_TYPE, lAccount.type);
//			
//			/* If the original call requested an auth token then provide one. */
//			if (lIntent.getExtras().getString(Authenticator.KEY_AUTH_TOKEN_TYPE) != null)
//			{
//				lResultBundle.putString(AccountManager.KEY_AUTHTOKEN, pAuthToken);
//			}
//		}
//		
//		/* Setup the result bundle to get sent back to the Authenticator. */
//		setAccountAuthenticatorResult(lResultBundle);
//		
//		/*
//		 * This causes the activity to complete (and close) and sends the bundle we just built back to the Authenticator
//		 * (or an error bundle if adding the account failed).
//		 */
//		finish();
//	}
}
